package com.zhongkun.datahome.framework.security.context;

import org.springframework.security.authentication.AbstractAuthenticationToken;

public class WechatAuthenticationToken extends AbstractAuthenticationToken {
    private final String phoneNumber; // 微信临时code

    private Object principal;  // openid或用户对象

    public WechatAuthenticationToken(Object principal, String phoneNumber) {
        super(null);
        this.phoneNumber = phoneNumber;
        this.principal = principal;
        setAuthenticated(false);
    }

    public WechatAuthenticationToken(String phoneNumber) {
        super(null);
        this.phoneNumber = phoneNumber;
        setAuthenticated(false);
    }

    @Override
    public Object getCredentials() { return null; }
    @Override
    public Object getPrincipal() { return principal; }

    public String getPhoneNumber() {
        return phoneNumber;
    }
}